﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Team4Mock.FormView
{
    public partial class MasterPage : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Convert.ToString(Session["user"])))
                {
                    HyperLink1.Visible = false;
                    HyperLink2.Visible = true;
                    hpPass.Visible = true;
                    lbHello.Visible = true;
                    lbHello.Text = "Hello <i>" + Session["user"]+"</i>";
                    lbHello.Text += " You have login to the permission to <i>" + Session["role"]+"</i>";
                    if (!string.IsNullOrEmpty(Convert.ToString(Session["role"])))
                    {
                        if(Session["role"].ToString().Equals("Admin"))
                        {
                            hyAccount.Visible = true;
                        }
                        else
                        {
                            hyAccount.Visible = false;
                        }
                    }
                }
                else
                {
                    HyperLink1.Visible = true;
                    HyperLink2.Visible = false;
                    lbHello.Visible = false;
                    hpPass.Visible = false;
                    hyAccount.Visible = false;
                }
            }
        }
    }
}